---
title: TrackingTransparency
description: A library for requesting permission to track the users on devices using iOS 14 and higher.
sourceCodeUrl: 'https://github.com/expo/expo/tree/sdk-50/packages/expo-tracking-transparency'
packageName: 'expo-tracking-transparency'
---

import APISection from '~/components/plugins/APISection';
import { APIInstallSection } from '~/components/plugins/InstallSection';
import PlatformsSection from '~/components/plugins/PlatformsSection';
import { AndroidPermissions, IOSPermissions } from '~/components/plugins/permissions';
import {
  ConfigReactNative,
  ConfigPluginExample,
  ConfigPluginProperties,
} from '~/ui/components/ConfigSection';
import { SnackInline } from '~/ui/components/Snippet';

A library for requesting permission to track the user or their device. Examples of data used for tracking include email address, device ID, advertising ID, and more. This permission is only necessary on iOS 14 and higher; on iOS 13 and below this permission is always granted. If the "Allow Apps to Request to Track" device-level setting is off, this permission will be denied. Be sure to add `NSUserTrackingUsageDescription` to your [**Info.plist**](/versions/latest/config/app/#infoplist) to explain how the user will be tracked. Otherwise, your app will be rejected by Apple.

For more information on Apple's new App Tracking Transparency framework, please refer to their [documentation](https://developer.apple.com/app-store/user-privacy-and-data-use/).

<PlatformsSection android emulator ios simulator />

## Installation

<APIInstallSection />

## Configuration in app.json/app.config.js

You can configure `expo-tracking-transparency` using its built-in [config plugin](/config-plugins/introduction/) if you use config plugins in your project ([EAS Build](/build/introduction) or `npx expo run:[android|ios]`). The plugin allows you to configure various properties that cannot be set at runtime and require building a new app binary to take effect.

<ConfigReactNative>

Learn how to configure the native projects in the [installation instructions in the `expo-tracking-transparency` repository](https://github.com/expo/expo/tree/main/packages/expo-tracking-transparency#installation-in-bare-react-native-projects).

</ConfigReactNative>

<ConfigPluginExample>

```json app.json
{
  "expo": {
    "plugins": [
      [
        "expo-tracking-transparency",
        {
          "userTrackingPermission": "This identifier will be used to deliver personalized ads to you."
        }
      ]
    ]
  }
}
```

</ConfigPluginExample>

<ConfigPluginProperties
  properties={[
    {
      name: 'userTrackingPermission',
      platform: 'ios',
      description:
        'Sets the iOS `NSUserTrackingUsageDescription` permission message in **Info.plist**.',
      default:
        '"Allow this app to collect app-related data that can be used for tracking you or your device."',
    },
  ]}
/>

## Usage

<SnackInline label='Basic tracking transparency usage' dependencies={['expo-tracking-transparency']}>

```jsx
import React, { useEffect } from 'react';
import { Text, StyleSheet, View } from 'react-native';
import { requestTrackingPermissionsAsync } from 'expo-tracking-transparency';

export default function App() {
  useEffect(() => {
    (async () => {
      const { status } = await requestTrackingPermissionsAsync();
      if (status === 'granted') {
        console.log('Yay! I have user permission to track data');
      }
    })();
  }, []);

  return (
    <View style={styles.container}>
      <Text>Tracking Transparency Module Example</Text>
    </View>
  );
}

const styles = StyleSheet.create({
  container: {
    flex: 1,
    alignItems: 'center',
    justifyContent: 'center',
  },
});
```

</SnackInline>

## API

```ts
import * as ExpoTrackingTransparency from 'expo-tracking-transparency';
```

<APISection packageName="expo-tracking-transparency" />

## Permissions

### Android

<AndroidPermissions permissions={['com.google.android.gms.permission.AD_ID']} />

### iOS

The following usage description keys are used by this library:

<IOSPermissions permissions={['NSUserTrackingUsageDescription']} />
